<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title >小强博客</title>
    <link  rel="stylesheet" type="text/css" href="/Public/css/bootstrap.min.css" />
    <script type="text/javascript" src="/Public/js/jquery-3.1.1.js"></script>
    <script type="text/javascript" src="/Public/js/bootstrap.js"></script>
    <script type="text/javascript" src="/Public/js/layer.js"></script>
</head>
<style>
    .navbar-inverse{
   border-radius: inherit;
    }
    .navbar nav li:hover{
        background-color: white;
    }
</style>
<body>
<nav class="navbar navbar-inverse">
    <div class="container">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header ">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">Blog v1.0</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li class="<?php if( CONTROLLER_NAME == 'Index' ): ?>active<?php endif; ?>"><a href="<?php echo U('Index/index');?>">
                <i class="glyphicon glyphicon-home">&nbsp;</i>首页  <span class="sr-only">(current)</span></a></li>
                <li  class="<?php if( CONTROLLER_NAME == 'Content' ): ?>active<?php endif; ?>"><a href="<?php echo U('Content/index');?>">内容</a></li>
                <li class="<?php if( CONTROLLER_NAME == 'Tools' ): ?>active<?php endif; ?>"><a href="<?php echo U('Tools/index');?>">功能</a></li>
                <li class="<?php if( CONTROLLER_NAME == '' ): ?>active<?php endif; ?>"><a href="#">用户</a></li>

            </ul>
            <ul class="nav navbar-nav navbar-right">
                <li><a href="/index.php"> 前台首页</a></li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                       aria-expanded="false"><span>您好 </span>&nbsp;<?php echo ($_SESSION['blog_admin']['name']); ?></a>
                    <ul class="dropdown-menu">
                        <li><a href="<?php echo U('Index/profile');?>">管理档案 </a></li>
                        <li><a href="<?php echo U('Index/quite');?>">注销 </a></li>
                    </ul>
                </li>
            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>
<div class="container">
    <div class="row">
                <div class="btn-group-vertical col-md-2">
        <a  class="btn btn-default  <?php if( CONTROLLER_NAME == 'Category' ): ?>active<?php endif; ?>" href="<?php echo U('Category/index');?>">
        <i class="glyphicon glyphicon-leaf">&nbsp;</i>分类管理 </a>
        <a  class="btn btn-default  <?php if( CONTROLLER_NAME == 'Tag' ): ?>active<?php endif; ?>" href="<?php echo U('Tag/index');?>" >
        <i class="glyphicon glyphicon-tags">&nbsp;</i>标签管理</a>
        <a  class="btn btn-default  <?php if( CONTROLLER_NAME == 'Article' ): ?>active<?php endif; ?>" href="<?php echo U('Article/index');?>" >
        <i class="glyphicon glyphicon-list-alt">&nbsp;</i>文章管理</a>

    </div>
        <div class="col-md-10">
            <div class="page-header"><h3> 管理标签</h3></div>
            <a  class="btn btn-default" href="<?php echo U('Tag/index');?>">所有标签</a>&nbsp;
            <a  class="btn btn-default" href="<?php echo U('Tag/add');?>"> 添加标签</a>
            <br><br>
               <?php if(is_array($tags)): foreach($tags as $key=>$t): ?><div class="btn-group" role="group">
                <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    <?php echo ($t['tname']); ?>
                    <span class="caret"></span>
                </button>
                <ul class="dropdown-menu">
                    <li><a href="<?php echo U('Tag/edit',array('tid'=>$t['tid']));?>">编辑</a></li>
                    <li><a href="javascript:delTag(<?php echo ($t['tid']); ?>)">删除</a></li>
                </ul>
            </div>&nbsp;&nbsp;&nbsp;&nbsp;<?php endforeach; endif; ?>
        </div>

</div>
    <script>
        function delTag(tid)
        {
            layer.confirm(' 确认删除？',{
             btn:['是','否']
        } ,function () {
                $.ajax({
                  'url':"<?php echo U('Tag/delete');?>",
                    'type':'POST',
                    'dataType':'json',
                    'data':{'tid':tid},
                    success:function(phpReturnData){
                      if(phpReturnData.status==1){
                          layer.msg(phpReturnData.message,{'icon':6},function () {
                              window.location=location;
                          } )
                      }else{
                          layer.msg(phpReturnData.message,{'icon':5});
                      }
                }
                })
            })
        }
    </script>
</body>
</html>